<template>
  <el-select
    :value="value"
    v-bind="$attrs"
    v-on="$listeners"
    @change="onChange"
  >
    <el-option v-for="item in options" :key="item" :label="item" :value="item"></el-option>
  </el-select>
</template>

<script>
export default {
  props: {
    value: [Number, String],
    start: {
      type: Number,
      default: 5,
    },
    end: {
      type: Number,
      default: 90,
    },
    interval: {
      type: Number,
      default: 5,
    },
  },

  computed: {
    options() {
      const {
        start,
        end,
        interval,
      } = this
      const times = end / interval
      const options = []
      for (let index = 0; index < times; index++) {
        options.push(start + index * interval)
      }
      return options
    },
  },

  methods: {
    onChange(val) {
      this.$emit('input', val)
    },
  }
}
</script>
